|
|
|
|
|
|
|
'
On Error Resume Next
'
rs.Close
db.Close
ws.Close
Set rs = Nothing
Set db = Nothing
Set ws = Nothing
'
End Sub |
|
|
|
|
|
|
|
|
Now that you have dealt with the properties, you're ready to start coding the main record-handling routines. The next several sections contain the code for all the record-handling routines. |
|
|
|
|
|
|
|
|
The RSOpen routine handles the opening of an existing database and the creation of a Recordset to hold the selected records. Enter Listing 10.9 into the class module. Be sure to include the Function declaration line. Visual Basic supplies the End Function line automatically. |
|
|
|
|
| |
|
|
|
|
You should save your work after entering each coding section to ensure that you do not lose much work if your computer suffers an unexpected crash. |
|
|
|
|
|
|
|
|
|
|
Listing 10.9. Coding the RSOpen function. |
|
|
|
|
|
|
|
|
Public Function RSOpen(frmTemp As Object)
'
' create ws, db, and rs objects
'
On Error GoTo LocalErr
'
Dim lngResult As Long
'
Set ws = dbengine.createworkspace(WSName, "admin", "")
Set db = ws.OpenDatabase(strDBName)
Set rs = db.OpenRecordset(strRSName, intRSType)
' |
|
|
|
|
|